

let Points = [
	[],
	[118.5313315, 36.0430809],
	[118.2525548, 36.17541369],
	[118.1564518, 36.15749647],
	[117.8120030, 36.23895927],
	[118.5823977, 36.03843440],
	[117.9705050, 36.21263167],
	[118.0104174, 36.18189058],
	[],
	[118.236158, 36.180022]
];

let IMGS = {
    '': '黑布林.png',
    '1': '山竹.png',
    '2': '苹果.png',
    '3': '草莓.png',
    '4': '菠萝.png',
    '11': '青柠.png',
    '12': '猕猴桃.png',
    '13': '罗汉果.png',
    '14': '无花果.png',
    '15': '水蜜桃.png',
    '16': '火龙果.png'
};
let imgs2 = {
	'1': '1.png', '2': '2.png', 
	'3': '3.png', '4': '4.png', 
	'11': '5.png', '12': '6.png', 
	'13': '7.png', '14': '8.png', 
	'15': '9.png', '16': '0.png'
};

function addPoints ( layer ) {
    let data = [
        {value: 1, name: "莱芜枢纽-辛庄虚收费门架", pos: [36.23895927, 117.812003]},
        {value: 1, name: "辛庄虚-鲁村虚收费门架", pos: [36.21263167, 117.970505]},
        {value: 1, name: "鲁村虚-沂源虚收费门架", pos: [36.18189058, 118.0104174]},
        {value: 1, name: "沂源虚-沂源东虚收费门架", pos: [36.15749647, 118.1564518]},
        {value: 1, name: "沂源东虚-张家坡虚收费门架", pos: [36.17541369, 118.2525548]},
        {value: 1, name: "张家坡虚-诸葛虚收费门架", pos: [36.0430809, 118.5313315]},
        {value: 1, name: "诸葛虚-马站枢纽收费门架", pos: [36.0384344, 118.5823977]}
    ];
    let data2 = [
        {value: 1, name: "沂源东收费站", pos: [36.180022, 118.236158]}
    ];
    let data3 = [
        {value: 1, name: "沂源服务区", pos: [36.162619, 118.184758]}
    ];
    let baseUrl = "https://maponline0.bdimg.com/sty/map_icons2x/MapRes/";
    
    function Transfor(d) { return [d.pos[1], d.pos[0]]; }
    function getSymbol (idx) {
        let img = ['tiyu.png?udt=20210923', 'jiayouzhan.png?udt=20210923', 'fuwuqu.png?udt=20210923'][idx];
        return {
            'symbol': {
                'markerFile': baseUrl + img,
                'markerWidth': 28, 'markerHeight': 30,
                'markerDx': 15, 'markerDy': 15, 'markerOpacity': 1
            }
        };
    }

    data.forEach(d => {
        let pos = Transfor(d);
        let marker = new maptalks.Marker(pos, getSymbol(0)).addTo(layer);  
    });
    
    data2.forEach(d => {
        let pos = Transfor(d);
        let marker = new maptalks.Marker(pos, getSymbol(1)).addTo(layer);   
    });
    
    data3.forEach(d => {
        let pos = Transfor(d);
        let marker = new maptalks.Marker(pos, getSymbol(2)).addTo(layer);   
    });

}